package com.example.basic.controller;

import com.alibaba.excel.util.StringUtils;
import com.example.basic.aop.OperationLogAnnotation;
import com.example.basic.constant.BaseConstants;
import com.example.basic.reslut.ResponseResult;
import com.example.basic.service.HeroInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author mjw
 * @date 2022/9/28
 */
@RestController
@Api(tags = "hero层的控制器")
@RequestMapping("/hero")
public class HeroInfoController {

    private final HeroInfoService heroInfoService;

    public HeroInfoController(HeroInfoService heroInfoService) {
        this.heroInfoService = heroInfoService;
    }

    @OperationLogAnnotation(operModel = "hero模块", operType = "查询", operDesc = "查询所有的信息")
    @ApiOperation("查询所有的hero和对应的camp的信息")
    @GetMapping("/selectAll")
    public ResponseResult<List<Object>> selectAll(@RequestParam("pageNum") int pageNum,
                                                  @RequestParam("pageSize") int pageSize,
                                                  @RequestParam(value = "queryType", required = false, defaultValue = "1") String queryType) {
        List<Object> list = heroInfoService.selectByCondition(pageNum, pageSize, queryType);
        return ResponseResult.success(list);
    }
}
